package com.example.jh352160.surfingtv.mypage.customView;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.example.jh352160.surfingtv.R;

/**
 * Created by jh352160 on 2016/7/26
 */

public class MypageItem extends LinearLayout {

    Context context;
    ImageView icon;
    TextView text;

    public MypageItem(Context context, AttributeSet attrs) {
        super(context, attrs);
        this.context = context;
        LayoutInflater.from(context).inflate(R.layout.mypage_item, this);
        icon = (ImageView) findViewById(R.id.item_icon);
        text = (TextView) findViewById(R.id.item_text);
    }

    public void setView(int iconId, String viewText) {
        icon.setImageResource(iconId);
        text.setText(viewText);
    }

    public void setView(String viewText) {
        text.setText(viewText);
        icon.setVisibility(INVISIBLE);
    }

}
